Computer programs often carry out a specific function such as word processing, database management and inter-system communications. Communication programs provide inter-program or inter-system communication capability among other functions. An example of such a communication program is Microsoft Mail, developed by Microsoft Corporation, Redmond, Wash. Microsoft Mail provides for the transfer of electronic information between connected computer systems. Programs such as Microsoft Mail include protocol components that control how the program communicates with other programs.
A set of requirements that define communication between programs is commonly referred to as a communication protocol. Protocols include X25 for modems and integrated services digital network (ISDN), which are standards developed by the computer industry. These protocols will dictate how data is formatted when it is to be transmitted over computer connections. For example, a protocol will dictate the amount of data in a packet (i.e., the size of a data chunk that is transmitted), the header information for a packet, and any other reliability or encoding that is to be done to the data that is being transmitted. Thus, when a program is described as conforming to X25, the user knows that the program can communicate with other "X25" programs since they all conform to the same protocol, e.g., they all handle data in the same manner. In addition to such industry protocols, there are other communication elements that improve or change the data transmission protocol such as encryption and compression. These two functions provide improved security and increased bandwidth, respectively. In practice, any set of requirements that is agreed on between two programs is the communication protocol for those programs. As an example, a protocol might be X25 with a particular type of run length encoding. The computer systems sending and receiving data pursuant to this protocol must be able to understand the X25 packaging and to compress and decompress the data according to the particular run length encoding scheme.
Although it might be referred to as a distinct part of a communication program, the protocol component is usually a combination of functions integrated into the communication program. Thus, once created, the protocol component is static within a communication program and cannot be changed without replacing or modifying the entire program. In order to change the protocol component of a communication program, the entire program would have to be recompiled or relinked. Thus, it is usually the case that a communication program's protocol is set when the program is created, e.g., coded by the company producing the program. To change the protocol, whether because of errors in the original protocol or because of modifications to the protocol, the entire program must be replaced. For users of multiple communication programs who need to interconnect computer systems operating these programs, this limitation on modifying protocols can be an absolute roadblock to system interconnection. Further, such integration of the protocol component makes it difficult if not impossible for third parties to provide enhancements to another company's communication program with respect to the protocol. This makes it difficult for third parties to add value to existing communication programs.
The general problem of separately developing and modifying program components is dealt with by some programmers by adopting object oriented programming techniques. The use of object oriented programming techniques can facilitate the development of complex computer programs by allowing key functions to be created as separate entities, which are testable and replaceable separate from the other program parts. One such programming language is C++. Object oriented programming basics are introduced herein for ease in understanding certain characteristics of the present invention.
Object oriented programming is based on class definition and usage. A class is a user-defined type that includes both data and the methods (procedures and functions) to operate on the data. The class definitions are used to create objects which are used in actual programs. To create and use an object, a class is declared, then an object of a class is declared (the object is instantiated) and then the object is used. The data is said to be encapsulated within the object to protect it from outside access except by means of the predefined method calls. When in use, an object is a component of a running program; the object has an internal state defined by the state of the object's variables and a published interface that allows other components to interact with the object. (The term "published" refers to the fact that the interface information is known to and can be used by other programs or clients.) The interface to an object is generally defined by the set of methods defined by the object's class. The interface is a set of methods which abide by certain input, output, and behavior rules. If an object supports a particular interface, the client program using the object can invoke the methods of that interface to effect the defined behavior. A client is bound to an object through a pointer to an interface.
Calling an object's methods is similar to sending the object a message--it causes the object to do something. In this sense, an object can be likened to a functions in a programming language such as Pascal. When a function is called from a client program it carries out the procedures it is programmed to perform; the particular procedure might depend on how the function is actually called.
There are several types of classes: concrete, abstract, and pure virtual classes. If an instance of the class can be made then it is a concrete class. In contrast, if an abstract class is being dealt with, an instance of the class cannot be made. Rather, an abstract class is useful because it defines an object's interface but does not define all of its behavior. It is the responsibility of the program implementing the class to provide the actual code for the methods available to manipulate the class instance data. Abstract classes are also called pure virtual classes in C++ programming terminology. An abstract class has one or more method undefined. In contrast, a pure virtual class has no methods defined. Therefore, to use an abstract class, some of the methods must be provided, where a pure virtual class requires that all methods are provided.
Class declarations and object instantiation are illustrated by the following example. A class named CIRCLE is declared as follows:
class CIRCLE PA1 {public PA1 int x, y; PA1 int radius PA1 void draw( );}; PA1 CIRCLE a, b; PA1 a.x=2; PA1 a.y=2; PA1 a.radius=1; PA1 b.x=4; PA1 b.y=5; PA1 b.radius=2; PA1 a.draw( ); PA1 b.draw( );
In the declaration, variables x and y specify the center location of a circle and variable radius specifies the radius of the circle. These variables are the data members of the class CIRCLE. The function draw is a user-defined function that draws the circle having the radius and location identified by the variables. The function draw is a method of the class CIRCLE. The data and methods of a class are bound together in that the method operates on an instance of the class, i.e., on the actual data. As noted above, an instance of the class is known as an object.
In C++ syntax, the following statement declares the objects a and b to be of type class CIRCLE.
This declaration causes the allocation of memory for the objects a and b, thereby creating two instances of the class CIRCLE. The following statements assign data to the data members of objects a and b.
Given those data assignments, the following statements are used to draw the circles defined by objects a and b.
This is a simple example of creating a class, creating an object or instance of the class, then assigning values to the data within the object and calling the methods of the object to carry out the object's function. These are standard object oriented processes illustrated with C++ type commands.
Another programming concept that is becoming quite common is the use of link libraries. A link library is an executable module containing services that programs can call to perform useful tasks. For example, a user identification library might be provided; a number of program could then incorporate the library into their programs with a simple set of calls, thereby avoiding the reinvention of the user identification process. The benefits of using libraries include: not having to recode the same or a similar function in a number of programs; less storage space is taken up because, at least initially, only one copy of the library code is required; and a number of program can have consistent functionality. These libraries play an important role in operating systems which use them to make their services and resources available to the programs that are executed in conjunction with the operating system.
Link libraries are often static-link libraries. These are used in C-language programs. When linking such a program before use, the compiler incorporates information from the appropriate static-link library directly into the program's executable file. The primary advantage of static-link libraries is that they make a standard set of services available to programs, and do not require the programs to include the original source code for those services. However, because static-link libraries are incorporated into the executable code of programs, the static-link libraries and programs lose their physical distinctiveness when linked. As a result, neither the programs nor the static-link libraries can be updated without having to re-link the static-link libraries with the programs. Re-linking is much like recompiling in that the process is necessary to create an executable program. Thus, the re-linking must be performed before the program can be used.
Dynamic-link libraries are similar to run-time libraries, such as C-language run-time libraries. However, dynamic-link libraries are linked with programs at run time, not when the programs' files are linked with a compiler. Since a dynamic-link library is linked at run time, not at compile time, a copy of the library is not inserted into the programs' executable files. Instead, a copy of the library is loaded into memory while the programs are actually running. As a result, the programs and dynamic libraries are always physically distinct. Such distinctness allows the programs and dynamic-link libraries to be updated, compiled, and tested separately from each other.
By using dynamic-link libraries, several programs can share a single copy of a service. If two programs are running at the same time and both use a particular service both can share a single copy of the source code for that service. In addition to being able to share a single copy of code, programs using dynamic-link libraries can share other resources, such as data and hardware.
Some object oriented languages also support the concept of a dynamic class. A dynamic class is similar to a conventional C++ class but allows a class object to be instantiated at run time, rather than during initial coding, thereby making it possible to build object oriented, run-time replaceable, run-time extendible code. A dynamic class can be fully defined in a dynamic-link library (DLL).
The present invention recognizes that these programming techniques provide tools that are particularly useful for creating dynamic protocol stacks. Particularly, the invention recognizes that protocol layers can be defined such that each layer performs a specific protocol function and that the interfaces between these protocol layers are necessarily consistent. By implementing a consistent object model, the protocol layers are interchangeable and independently modifiable, and the protocol stack is dynamically modifiable. This solves the current problem of fixed protocol functionality.